{php include wl_template('common/header');}
<link rel="stylesheet" href="{TG_URL_ARES}components/light/light7.min.css">
<link rel="stylesheet" href="{TG_URL_ARES}components/weui/weui.css">
<script type='text/javascript' src='{TG_URL_ARES}components/light/light7.min.js' charset='utf-8'></script>
<script type="text/javascript" src="{MODULE_URL}app/resource/layer/layer.js" ></script>
<script type='text/javascript' src='{TG_URL_ARES}js/laytpl.js' charset='utf-8'></script>
<link rel="stylesheet" href="{TG_URL_ARES}css/common.css">
<style>
    .timline-block-arrow{
        border-top: 1px solid transparent;
        border-left: 1px solid transparent;
    }
    .timeline-block{
        border:1px solid transparent!important;
    }
    .voucher-goods-info {
        border-bottom: 1px solid #aaa;
    }
    .nav-choose,.bottombar-btn-red,.order-total-price .price{
        color: #ff5c67;
    }
    .nav-bottomline,.nav-bottomlineright{
        background-color: #ff5c67;
    }
    .bottombar-btn-red,.bottombar-btn-red{
        border: 1px solid #ff5c67!important;
    }
</style>
<div class="page-group">
    <div class="page page-current" id="page-order-detail">
        <header class="bar bar-nav">
            <a style="color:#ff5c67" class="button button-link button-nav pull-left back" href="{php echo app_url('order/order/list')}"><span class="icon icon-left"></span>返回</a>
            <h1 class="title">详情</h1>
        </header>

        <div class="content" style="overflow-x: hidden;">
            <div id="nav" class="nav">
                <p class="nav-wrap">
                    <span class="j-nav-item j-nav-status nav-item nav-choose">预约状态</span>
                    <span class="j-nav-item j-nav-detail nav-item ">预约详情</span>
                    <label class="j-nav-bottomline nav-bottomline"></label>
                </p>
            </div>
            <div id="order-status">
                <div class="timeline">
                    <div class="timeline-item">
                        <img class="timeline-logo" src="http://p1.meituan.net/xianfu/8adf62cf3cb75f1a4b21380be10af9fa2048.png">
                        <div class="timeline-block">
                            <i class="timline-block-arrow"></i>
                            <p class="timeline-title">预约已提交<span class="timeline-time">{if !empty($order['createtime'])}{php echo date('m-d H:i', $order['createtime']);}{/if}</span></p>
                            <p class="timeline-sub">等待用户支付预约</p>
                        </div>
                    </div>
                    {if $order['ptime']}
                    <div class="timeline-connect timeline-connect-21"></div>
                    <div class="timeline-item">
                        <img class="timeline-logo" src="http://p0.meituan.net/xianfu/794ec85889844239f32764861c56660a2048.png">
                        <div class="timeline-block">
                            <i class="timline-block-arrow"></i>
                            <p class="timeline-title">支付成功<span class="timeline-time">{php echo date('m-d H:i', $order['ptime']);}</span></p>
                            <p class="timeline-sub"></p>
                        </div>
                    </div>
                    {/if}
                    {if $order['status']==9}
                    <div class="timeline-connect timeline-connect-12"></div>
                    <div class="timeline-item">
                        <span class="icon icon-refresh timeline-logo" style="background-color: #FFD705;text-align: center;border-radius:11px;color: #7C5609;"></span>
                        <div class="timeline-block">
                            <i class="timline-block-arrow"></i>
                            <p class="timeline-title">预约已取消<span class="timeline-time"></span></p>
                            <p class="timeline-sub"></p>
                        </div>
                    </div>
                    {/if}
                    {if $order['godluck']==1}
                    <div class="timeline-connect timeline-connect-12"></div>
                    <div class="timeline-item">
                        <span class="icon icon-check timeline-logo" style="background-color: #FFD705;text-align: center;border-radius:11px;color: #7C5609;"></span>
                        <div class="timeline-block">
                            <i class="timline-block-arrow"></i>
                            <p class="timeline-title">预约已中奖<span class="timeline-time"></span></p>
                            <p class="timeline-sub">我们将尽快为您发货</p>
                        </div>
                    </div>
                    {/if}
                    {if $order['godluck']==0&&$order['selltype']==5&&$order['issued']==0}
                    <div class="timeline-connect timeline-connect-12"></div>
                    <div class="timeline-item">
                        <span class="icon icon-check timeline-logo" style="background-color: #FFD705;text-align: center;border-radius:11px;color: #7C5609;"></span>
                        <div class="timeline-block">
                            <i class="timline-block-arrow"></i>
                            <p class="timeline-title">预约未开奖,请耐心等待哦<span class="timeline-time"></span></p>

                        </div>
                    </div>
                    {/if}
                    {if $order['godluck']==0&&$order['selltype']==5&&$order['issued']==1}
                    <div class="timeline-connect timeline-connect-12"></div>
                    <div class="timeline-item">
                        <span class="icon icon-check timeline-logo" style="background-color: #FFD705;text-align: center;border-radius:11px;color: #7C5609;"></span>
                        <div class="timeline-block">
                            <i class="timline-block-arrow"></i>
                            <p class="timeline-title">预约未中奖<span class="timeline-time"></span></p>
                            {if $order['status']==8}<p class="timeline-sub">我们将尽快为您退款</p>{/if}
                            {if $order['status']==7}<p class="timeline-sub">预约已退款,优惠券已发放</p>{/if}
                            {if $order['status']==10}<p class="timeline-sub">我们正在尽快为您退款</p>{/if}
                        </div>
                    </div>
                    {/if}
                    {if $order['sendtime']}
                    <div class="timeline-connect timeline-connect-12"></div>
                    <div class="timeline-item">
                        <img class="timeline-logo" src="http://p0.meituan.net/xianfu/a34001a981214d535bd8466da34490502048.png">
                        <div class="timeline-block">
                            <i class="timline-block-arrow"></i>
                            <p class="timeline-title">商家发货<span class="timeline-time">{php echo date('m-d H:i', $order['sendtime']);}</span></p>
                            <p class="timeline-sub">活动已记录，请耐心等待哦</p>
                        </div>
                    </div>
                    {/if}
                    {if ($_W['uniacid'] == 5 && $order['gettime']) || ($_W['uniacid'] == 6 && $order['status'] == 3) || ($_W['uniacid'] == 4 && $order['status'] == 3) || ($_W['uniacid'] == 13 && $order['status'] == 3)}
                    <div class="timeline-connect timeline-connect-12"></div>
                    <div class="timeline-item">
                        <span class="icon icon-check timeline-logo" style="background-color: #FFD705;text-align: center;border-radius:11px;color: #7C5609;"></span>
                        <div class="timeline-block">
                            <i class="timline-block-arrow"></i>
                            <p class="timeline-title">预约已完成<span class="timeline-time">{php echo date('m-d H:i', $order['gettime']);}</span></p>
                            <p class="timeline-sub">感谢您的信任，祝您生活愉快</p>
                        </div>
                    </div>

                    {/if}
                    {if $notshow != 1}

                    <!--<div class="timeline-connect timeline-connect-12"></div>-->
                    <!--<div class="timeline-item">-->
                        <!--<span class="icon icon-message timeline-logo" style="background-color: #FFD705;text-align: center;border-radius:11px;color: #7C5609;"></span>-->
                        <!--<a href="{php echo app_url('order/order',array('op' => 'judgment_detail','id' => $order['id']))}"><div class="timeline-block">-->
                            <!--<i class="timline-block-arrow"></i>-->
                            <!--<p class="timeline-title" style="color: #ff5c67;text-align: left;">开始评价</p>-->
                            <!--<p class="timeline-sub">点击输入您要评价的内容</p>-->

                        <!--</div>-->
                        <!--</a>-->
                    <!--</div>-->
                    {/if}
                    {if $order['status']==4||$order['status']==6||$order['status']==7}
                    <div class="timeline-connect timeline-connect-12"></div>
                    <div class="timeline-item">
                        <span class="icon icon-check timeline-logo" style="background-color: #FFD705;text-align: center;border-radius:11px;color: #7C5609;"></span>
                        <div class="timeline-block">
                            <i class="timline-block-arrow"></i>
                            <p class="timeline-title">预约已退款{if $order['issued']==2},优惠券已发放{/if}<span class="timeline-time"></span></p>

                            <p class="timeline-sub">{if $order['issued']==2}很遗憾未中奖,{/if}感谢您的信任,祝您生活愉快</p>
                        </div>
                    </div>
                    {/if}

                </div>

                <div class="bottombar-placeholder"></div>

                <div class="bottombar-down">
                    <div class="bottombar">

                        <div class="bottombar-main" style="margin-left:15px;">
                            <div class="bottombar-buttonwrap bottombar-buttonwrap-3">
                                {if $order['status'] != 0 && $order['status'] != 3 && $order['status'] != 10}
                                <button class="combtn bottombar-btn-red open-popup" id="qrcode" data-popup=".popup-qrcode"style="{if $order['status'] == 9}display:none;{/if}width:90px;text-align:center;"><i class="fa fa-qrcode" ></i>&nbsp核销二维码</button>
                                {/if}
                                {if $order['status'] == 2}
                                <button id="btn-hasten" class="combtn bottombar-btn-dark">物流信息</button>
                                {else}
                                <button class="combtn bottombar-btn-red" style="width: 30%;" onclick="location.href='{php echo app_url('goods/list');}'">更多活动</button>
                                {/if}
                                {if $order['is_tuan']==1 && $order['status']!=5}
                                <button class="combtn bottombar-btn-dark" onclick="location.href='{php echo app_url('order/group', array('tuan_id'=>$order['tuan_id']));}'" style="width:90px;">查看团详情</button>
                                {/if}
                                {if $order['godluck']==0 && $order['status']==7}
                                <button class="combtn bottombar-btn-dark" onclick="location.href='{php echo app_url('member/coupon');}'" style="width:82px;">查看优惠券</button>
                                {/if}
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div id="order-detail" style="display: none">
                <div class="orderregion">
                    <a class="status-hotelname" href="#">
                        <i class="icon1-detail status-hotelname-icon"></i>
                        <label class="status-hotelname-name">{$order['merchant_name']}</label>
                        <i class="icon-arrow-right-thin status-hotelname-back"></i>
                    </a>
                </div>

                <div class="orderregion orderregion-top">
                    <ul class="orderregion-entries">
                        {if $order['g_id']>0}
                        <li class="orderregion-entry">
                            <span class="name text-overflow-ellipsis-2">{$order['goodsname']}</span>
                            <!-- <span class="price">￥{php echo $goods['gprice']*$order['gnum']}</span>-->
                            <span class="price" >{if $order['is_tuan']==0}{$goods['oprice']}{elseif $order['is_tuan']==1}{$goods['gprice']}{/if}×{$order['gnum']}</span>
                        </li>
                        {else}
                        <?php
								$col=pdo_fetchall("select * from ".tablename('tg_collect')." where  orderno=:orderno",array('orderno'=>$order['orderno']));
                        ?>
                        {loop $col $v}
                        <?php
								$gs=pdo_fetch("select * from ".tablename('tg_goods')." where  id=:id",array('id'=>$v['sid']));

                        ?>
                        <li class="orderregion-entry">
                            <span class="name text-overflow-ellipsis-2">{$v['goodsname']}</span>
                            <!--<span class="name text-overflow-ellipsis-2">规格：{$v['item']}</span>-->
                            <!-- <span class="price">￥{php echo $goods['gprice']*$order['gnum']}</span>-->
                            <span class="price" >{$v['oprice']}×{$v['num']}</span>
                        </li>

                        {/loop}
                        {/if}
                    </ul>
                </div>
                <?php
								$refund=pdo_fetch("select * from ".tablename('tg_order_level_refund')." where  orderno=:orderno",array('orderno'=>$order['orderno']));
                $realprice=	round($order['pay_price'],2)-round($refund['refundprice'],2);
                ?>
                <div class="orderregion">
                    <ul class="orderregion-entries">
                        {if $gs['selltype']==4}
                        <li class="orderregion-entry order-other-price">
                            <span class="name text-overflow-ellipsis-2">返还</span>
                            <span class="price">￥&nbsp;{$refund['refundprice']}</span>
                        </li>
                        {/if}
                        <!--<li class="orderregion-entry order-other-price">-->
                            <!--<span class="name text-overflow-ellipsis-2">运费</span>-->
                            <!--<span class="price">￥&nbsp;{$order['freight']}</span>-->
                        <!--</li>-->
                        <li class="orderregion-entry order-total-price">
                            <span class="name text-overflow-ellipsis-2">合计</span>
                            <span class="price">￥&nbsp;{$realprice}</span>
                        </li>
                    </ul>
                </div>

                <!--门店-->
                {if $order['dispatchtype'] == 3}
                <div class="orderregion">
                    <h1 class="orderregion-title">
                        <i class="icon1-detail status-detail-icon"></i>
                        <label class="status-name">核销信息</label>
                    </h1>
                    <ul class="orderregion-entries-compact">
                        <li class="orderregion-entry-compact">
                            <span class="label">收货人：</span>{$order['addname']}&nbsp; {$order['mobile']}
                        </li>

                        <li class="orderregion-entry-compact">
                            <span class="label">提货点：</span>{$sto['storename']}
                        </li>
                        <li class="orderregion-entry-compact">
                            <span class="label">核销员：</span>{$sal['nickname']}
                        </li>
                        <li class="orderregion-entry-compact" id="hexiaotime">
                            <span class="label">核销时间：</span>{php echo date('Y-m-d H:i:s', $order['hexiaotime']);}
                        </li>
                    </ul>
                </div>
                <!--<div class="good_speci" onclick="showStores(this)" show="1">适用的商家信息<i class="fa fa-angle-down" style="float:right; line-height:44px; font-size:26px;"></i></div>
                  <div>
                      {loop $stores $stores}
                    <div class="store">
                        <div class="info">
                        <div class="ico"><i class="fa fa-university"></i></div>
                        <div class="info1">
                            <div class="inner">
                                 <div class="user">{$stores['storename']}</div>
                                 <div class="addresss">地址: {$stores['address']}</div>
                                 <div class="tel">电话: {$stores['tel']}</div>
                             </div>
                         </div>
                         <a href="http://api.map.baidu.com/marker?location={$stores['lat']},{$stores['lng']}&amp;title={$stores['storename']}&amp;name={$stores['storename']}&amp;content={$stores['address']}&amp;output=html" class="external"><div class="ico2"><i class="fa fa-map-marker"></i></div></a>
                         <a href="tel:{$stores['tel']}" class="disable-router"><div class="ico3"><i class="fa fa-phone"></i></div></a>
                        </div>
                    </div>
                    {/loop}
                   </div>-->
                {else}
                <div class="orderregion">
                    <h1 class="orderregion-title">
                        <i class="icon1-detail status-detail-icon"></i>
                        <label class="status-name">活动人信息</label>
                    </h1>
                    <ul class="orderregion-entries-compact">
                        <li class="orderregion-entry-compact">
                            <span class="label">活动人：</span>{$order['addname']}&nbsp; {$order['mobile']}
                        </li>
                        <!-- <li class="orderregion-entry-compact">
                            <span class="label">收货地址：</span>{$order['address']}
                        </li> -->
                    </ul>
                </div>
                {/if}

                <div class="orderregion">
                    <h1 class="orderregion-title">
                        <i class="icon1-detail status-detail-icon"></i>
                        <label class="status-name">预约详情</label>
                    </h1>
                    <ul class="orderregion-entries-compact">
                        <li class="orderregion-entry-compact">
                            <span class="label">预约号码：</span>{$order['orderno']}
                        </li>
                        <li class="orderregion-entry-compact">
                            <span class="label">预约时间：</span>{php echo date('Y-m-d H:i:s', $order['createtime']);}
                        </li>
                        <li class="orderregion-entry-compact">
                            <span class="label">支付方式：</span>微信支付
                        </li>
                        {if $order['remark']}
                        <li class="orderregion-entry-compact">
                            <span class="label">备注：</span>{$order['remark']}
                        </li>
                        {/if}
                    </ul>
                </div>

                <div class="buy-again-placeholder"></div>
            </div>
        </div>
    </div>
</div>
</div>
<div class="popup popup-qrcode">
    <div class="content" style="background: #eee;">
        <div class="list-block cards-list">
            <ul>
                <li class="card" style="border-radius: .2rem;">
                    <div class="card-header"><h3 class="font-size-14">活动核销凭证</h3></div>
                    <div class="card-content" style="border-top: 1px solid #e5e5e5">

                        <div class="card-content-inner">
                            <p style="text-align: center; font-size: 1.1em; ">参加活动时请将本二维码出示给老师，可截图保存</p>

                           
                            {if $order['g_id']>0}
                            <div class="voucher-goods-info font-size-14">
                                <p>活动名称：{$goods['gname']} </p>
                                {if !empty($order['optionname'])}<p>活动规格：{$order['optionname']} </p>{/if}
                                <p>数量：{$order['gnum']}</p>
                                <p>实付金额：{$order['pay_price']}元</p>
                            </div>

                            {else}

                            <?php


                            $col=pdo_fetchall("select * from ".tablename('tg_collect')." where  orderno=:orderno",array('orderno'=>$order['orderno']));
                            ?>
                            {loop $col $v}
                            <?php
                              $createqrcode =  new creat_qrcode();
		                    $createqrcode->creategroupQrcode($v['id']);
                          	$gs=pdo_fetch("select * from ".tablename('tg_goods')." where  id=:id",array('id'=>$v['sid']));
                            ?>

                            <div class="voucher-goods-info font-size-14">
                                <p >
                                    <img style=" width: 100%;" src="{TG_URL}data/qrcode/{$_W['uniacid']}/{$v['id']}.png" alt="">

                                </p>
                                <p>{$gs['gname']}</p>
                                <p>{if !empty($v['item'])}规格：{$v['item']},{/if}</p>
                                <p>数量:{$v['num']},单价:{$v['oprice']}</p>

                                <hr style="margin-top: 10px;margin-bottom: 0px;"/>
                            </div>

                            {/loop}
                            {/if}
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <div class="weui_btn_area">
            <a class="weui_btn weui_btn_warn close-popup">关闭</a>
        </div>
    </div>
</div>
<script>
    {if $order['status']==3}
    $('#qrcode_pic').hide();
    $('#pcqrcode_pic').hide();
    {/if}
    {if ($order['godluck']==1&&$order['selltype']==5)||$order['selltype']!=5}
    window.onload = function () {
        var url = location.href;
        var popupQrcode = document.getElementsByClassName("popup popup-qrcode")[0];
        if (url.indexOf("b=1") > 0) {
            popupQrcode.classList.add("modal-in");
            popupQrcode.style.display = 'block';
        }
    }
    {/if}
    if (document.getElementById("hexiaotime")){
        var hexiaotime=document.getElementById("hexiaotime").innerHTML.slice(52,71);
        //alert(hexiaotime == "1970-01-01 08:00:00");
        if (hexiaotime == "1970-01-01 08:00:00"){
            document.getElementById("hexiaotime").innerHTML = '<span class="label">核销时间：未核销</span>';
        }
    }
    $(document).on('click','#btn-received',function(){
        var orderno = $(this).attr('oid');
        $.confirm('是否确认收货？',
                function () {
                    $.post("{php echo app_url('order/order/receipt')}",{orderno:orderno},function(d){
                        if(d.status == 1){
                            $.toast('确认收货成功！');
                            setTimeout(function () {
                                location.href = "{php echo app_url('order/order/detail')}"+'id='+orderno;
                            }, 1000);
                        }else{
                            $.toast(d.result);
                        }
                    },"json");
                }
        );
    });

    $(document).on('click','#btn-hasten',function(){
        $.showIndicator();
        setTimeout(function () {
            location.href = "http://m.kuaidi100.com/index_all.html?type={$order['express']}&postid={$order['expresssn']}#input";
        }, 1000);
    });

    $(".j-nav-status").bind('click', function() {
        $('.j-nav-status').addClass('nav-choose');
        $('.j-nav-detail').removeClass('nav-choose');
        $('.j-nav-bottomline').removeClass('nav-bottomlineright').addClass('nav-bottomline');
        $('#order-status').show();
        $('#order-detail').hide();
    });
    $(".j-nav-detail").bind('click', function() {
        $('.j-nav-detail').addClass('nav-choose');
        $('.j-nav-status').removeClass('nav-choose');
        $('.j-nav-bottomline').removeClass('nav-bottomline').addClass('nav-bottomlineright');
        $('#order-status').hide();
        $('#order-detail').show();
    });

    $(".j-nav-qrcode").bind('click', function() {
        $('.j-nav-qrcode').addClass('nav-choose');
        $('.j-nav-pcqrcode').removeClass('nav-choose');
        $('.j-nav-code-bottomline').removeClass('nav-bottomlineright').addClass('nav-bottomline');
        $('#qrcode_pic').show();
        $('#pcqrcode_pic').hide();
    });
    $(".j-nav-pcqrcode").bind('click', function() {
        $('.j-nav-pcqrcode').addClass('nav-choose');
        $('.j-nav-qrcode').removeClass('nav-choose');
        $('.j-nav-code-bottomline').removeClass('nav-bottomline').addClass('nav-bottomlineright');
        $('#qrcode_pic').hide();
        $('#pcqrcode_pic').show();
    });
</script>
{php include wl_template('common/footer');}